package spring.boot.adminx.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import spring.boot.adminx.mapper.WxMiniFirstPageMapper;
import spring.boot.adminx.model.WxMiniFirstPage;

@Service
public class WxMiniFirstPageService extends ServiceImpl<WxMiniFirstPageMapper, WxMiniFirstPage> {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public Long selectWxMiniAppIdById(long id){
        WxMiniFirstPage WxMiniFirstPage = getById(id);
        return WxMiniFirstPage.getWxMiniAppId();
    }


    public void delFirstPageKey(String wxMiniAppId){
        stringRedisTemplate.delete(getFirstPageKey(wxMiniAppId));
    }


    private String getFirstPageKey(String wxMiniAppId){
        return "GUAGUA_PHOTO_FIRST_PAGE_LIST_"+wxMiniAppId;
    }
}
